package org.dromara.patrol.domain.model.snap;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.apache.commons.compress.utils.Lists;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.core.enums.patrol.snap.RepeatType;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
public class SnapExecuteRule implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 循环类型 CURRENT_DAY 当天, WEEKLY 每周
     * @see org.dromara.common.core.enums.patrol.snap.RepeatType
     */
    @NotNull(message = "循环类型不能为空", groups = { AddGroup.class, EditGroup.class })
    private RepeatType cycleType;
    /**
     * 周循环规则[1-7] 1代表周一，7代表周日
     *
     * 注意：改字段与任务列表规则不同，任务列表规则为[1-7] 1代表周日，7代表周六
     */
    private List<Integer> weeklyRule = Lists.newArrayList();
    /**
     * 自定义规则
     */
    private List<String> customRule;
    /**
     * 抓拍时间
     */
    @NotEmpty(message = "抓拍时间不能为空", groups = { AddGroup.class, EditGroup.class })
    @Valid
    private List<SnapTime> snapTime;
}
